package cn.edu.nju.freshdelivery.action.buyer;

import java.util.List;

import javax.annotation.Resource;

import org.apache.struts2.json.annotations.JSON;
import org.springframework.stereotype.Component;

import cn.edu.nju.freshdelivery.model.Seller;
import cn.edu.nju.freshdelivery.service.SellerService;

import com.opensymphony.xwork2.ActionSupport;

/**
 * 请求获取卖方列表的action
 * @author RJXY
 *
 */
@Component
public class SellerListAction extends ActionSupport{
	
	/**需要返回的已通过验证的餐厅列表*/
	private List<Seller> list = null;
	private SellerService sellerService;
	
	public List<Seller> getList() {
		return list;
	}

	public void setList(List<Seller> list) {
		this.list = list;
	}
	@JSON(serialize=false)
	public SellerService getSellerService() {
		return sellerService;
	}
	@Resource
	public void setSellerService(SellerService sellerService) {
		this.sellerService = sellerService;
	}

	@Override
	public String execute() throws Exception {
		list = sellerService.findByValid(true);
		return SUCCESS;
	}
}
